<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:a4j="http://richfaces.org/a4j" 
	xmlns:rich="http://richfaces.org/rich"
	xmlns:mir="http://www.miranteinfo.com/seam/taglib"
	xmlns:mirfn="http://www.miranteinfo.com/seam/functions">
<ui:composition>
	
	<a4j:outputPanel id="#{id}" rendered="#{mirfn:getDefaultValue(rendered, true)}">
		
		<c:choose>
			<c:when test="#{type eq 'cpf'}">
				<mir:inputCPF 	id="#{id}Generic">
					<ui:insert/>
				</mir:inputCPF>
			</c:when>
		
			<c:when test="#{type eq 'cnpj'}">
				<mir:inputCNPJ 	id="#{id}Generic">
					<ui:insert/>
				</mir:inputCNPJ>
			</c:when>
			
			<c:when test="#{type eq 'number'}">
				<mir:inputNumber id="#{id}Generic">
					<ui:insert/>
				</mir:inputNumber>
			</c:when>
			
			<c:when test="#{type eq 'date'}">
				<mir:inputDate id="#{id}Generic">
					<ui:insert/>
				</mir:inputDate>
			</c:when>
			
			<c:otherwise>
				
				<a4j:outputPanel rendered="#{not empty mask}">
					<a4j:loadScript src="resource://com/miranteinfo/seam/facelets/js/jquery.meiomask.js"/>
					<rich:jQuery selector="##{id}GenericInput" query="setMask({#{mask}})" timing="onload" />
					<rich:jQuery selector="##{id}GenericInput" query="setMask({#{mask}})" timing="immediate" />
				</a4j:outputPanel>
				
				<h:inputText id="#{id}GenericInput"
							 value="#{value}"
							 accesskey="#{accesskey}"
							 alt="#{alt}"
							 autocomplete="#{mirfn:getDefaultValue(autocomplete,'off')}"
							 disabled="#{mirfn:getDefaultValue(disabled, false)}"
							 immediate="#{mirfn:getDefaultValue(immediate, false)}"
							 label="#{label}"
							 readonly="#{mirfn:getDefaultValue(readonly, false)}"
							 required="#{mirfn:getDefaultValue(required, false)}"
							 size="#{size}"
							 style="#{style}"
							 styleClass="#{styleClass}"
							 tabindex="#{tabindex}"
							 title="#{title}">
							
					<ui:insert/>
					
					<c:if test="#{not empty converter}">
						<f:converter converterId="#{converter}"/>
					</c:if>
					
					<c:if test="#{not empty validator}">
						<f:validator validatorId="#{validator}"/>
					</c:if>
					
				</h:inputText>
			
			</c:otherwise>
			
		</c:choose>
	</a4j:outputPanel>
	
</ui:composition>
</html>
